package com.tg.demo.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.tg.demo.service.IAsyncDemoService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author Rubble
 * @date 2020/7/31
 */
@Service
public class AsyncDemoServiceImpl implements IAsyncDemoService {


    @Async("poolTaskExecutor")
    @Override
    public void process(String param) {
        System.out.println("process "+param +" "+ DateUtil.now());
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
